package com.kehao.useful_method;

import org.junit.Test;

public class StringHelper {

    //1. 字符串切割
    @Test
    public void split(){
        String str = "are you ok ?";
        String[] strings = str.split(" ");
        for (int i = 0; i < strings.length; i++) {
            System.out.println(strings[i]);
        }
    }

    @Test
    public void firstLocation(){
        String str = "are you ok ?";

        int index1 = str.indexOf('r');
        System.out.println(index1);

        int index2 = str.indexOf("you");
        System.out.println(index2);
    }

    //3. 大小写变换
    @Test
    public void upAndLow(){
        String str = "Are you ok ?";
        String upperStr = str.toUpperCase();
        String lowerStr = str.toLowerCase();
        System.out.println(upperStr);
        System.out.println(lowerStr);
    }
}
